package com.zxbg.dao;

import com.zxbg.domain.Setting;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface SettingDao {
    @Select("select * from setting where tenant_id = #{tenant_id}")
    public Setting getAllSettingsMap(Integer tenant_id);

    @Update("update setting set ${type} = #{value} where tenant_id = #{tenant_id}")
    public int setIntSetting(@Param("type") String type, @Param("value") Integer value, @Param("tenant_id") Integer tenant_id);

    @Update("update setting set ${type} = #{value} where tenant_id = #{tenant_id}")
    public int setStringSetting(@Param("type") String type, @Param("value") String value, @Param("tenant_id") Integer tenant_id);

    @Select("select login_code from setting where tenant_id = #{tenant_id}")
    public int getLoginCodeByTenantId(Integer tenant_id);
}
